﻿using net_path.CSM.Common;
using net_path.CSM.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchSocket.Core;
using TouchSocket.Http;

namespace net_path.CSM.plugins
{
    /// <summary>
    /// 应用专属接口
    /// </summary>
    internal class NetPathPlug : NetPathPluginBase
    {
        protected override string ListenUri { get; } = "/net-path";
        protected override async Task OnRequest(NetPathSession session)
        {
            if (session.IsPost("/net-path"))
            {
                var output = new NetPathOutput();
                output.Success = true;

                if (output.Success)
                {
                    var data = await session.GetData<NetPathInput>();
                    switch (data.Method)
                    {
                        default:
                            output.Success = false;
                            break;
                    }

                }

            SEND_APP_REP:
                await session.Send(200, output)
                    .AnswerAsync();
            }

            await session.InvokeNext();
        }
    }
}
